home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / Campaign4Startup.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  4.8 KB  |  199 lines

  1.  
  2. function DrillerCinematic()
  3.  
  4.     local CinemaInvader  = G.CreateAt( "Driller", Vector3( 125, 0, 125 ) );
  5.     CinemaInvader.TurnOffAI()    
  6.     
  7.     Camera.CinemaMove( Vector3(150,15,150), Vector3(126,10,130), 2 );
  8.     Camera.CinemaLookAt( CinemaInvader );
  9.  
  10.     -- Driller appears:
  11.     G.SayPhraseScript( "Traitor! \nWe'll get you" , CinemaInvader );
  12.  
  13.     TraitorTalk( "Drillers! They'll dig under our defenses, and attack the tower directly! " );
  14.     GameWait(4)
  15.  
  16.     G.SayPhraseScript( "Let's Get them!" , CinemaInvader );
  17.     G.CreateAt( "Driller", Vector3( 130, 0, 125 ) );
  18.     G.CreateAt( "Driller", Vector3( 125, 0, 130 ) );
  19.     GameWait(3)
  20.     
  21.     CinemaInvader.TurnOnAI()
  22.     
  23. end
  24.  
  25. --Common Level Start Code
  26. function LevelStartup()
  27.  
  28.     G.Create( "MenuData/HudCog.xml" );
  29.     G.Create( "Data/GameCamera.xml" );
  30.     G.Create( "Data/CursorCog.xml" );
  31.  
  32.     MainLevel = G.Create( "Data/Levels/Campaign4.xml" );
  33.     MainLevel.CreateLevel();
  34.  
  35.     G.SetInvSpeed( 20 );
  36.     HUD.EnterLevel();
  37.     G.SetGameState( InLevel );
  38.     G.SetPoints(0);
  39.     G.SetMaxKills(0)
  40.     
  41.     G.SetLightTime( 5 );
  42.     G.PostP( "None" );
  43.  
  44.     -- gameStartTime = 10000000;
  45.  
  46.     HUD.Message( "VictoryCondition" , "SetText", "Defy the Driller Invasion!"  );
  47.     HUD.Message( "LossCondition" , "SetText", "If the Tower falls you lose." );
  48.         
  49.     TraitorCanBeHidden = true
  50.     --TraitorTalk(" ");
  51. end
  52.  
  53. LevelStartup()
  54.  
  55. function LevelIntro()
  56.     
  57.     local tempPos = Tower.GetPosition()
  58.     Camera.LookAtPosition( tempPos )
  59.  
  60.  
  61.     gameStartTime = GameTime;
  62.  
  63.     ColorTextPopup( "Level 4: Barricade", Color(1,1,1,1) )
  64.  
  65.     G.DisableTrapAll()
  66.         
  67.     G.EnableTrap("wall");
  68.     G.EnableTrap("bomb");
  69.     G.EnableTrap("axe");
  70.     G.EnableTrap("hammer");
  71.     
  72.  
  73.     DisableTraitor()
  74.     GameWait(1.5)
  75.     
  76.     TraitorTalk("Look what we have here!  Lasers!  Now we're talkin'.");
  77.     GameWait(6)
  78.     TraitorTalk("These lasers are good for hitting invaders at a distance, even from behind walls.");
  79.     GameWait(8)
  80.     TraitorTalk("Here are the blueprints...");
  81.     GameWait(2)
  82.     TrapTextPopup("Laser Turret")    
  83.     G.EnableTrap("laser");
  84.     GameWait(3)
  85.     TraitorTalk("I think I see some invaders coming...  Have fun!");
  86.     G.EarnPoints( 100 );
  87.     GameWait(6)
  88. end
  89.  
  90. function LevelSequence()
  91.     
  92.     -- 1st Have a tower and some walls and let the Basic guys attack.
  93.     DisableTraitor()
  94.     Traitor.SetGuiPosition( "TraitorWindow"  , Vector3(0.6, -0.5, 1) );
  95.     
  96.     -- Set the spawn points
  97.     
  98.     SpawnPoints = {}
  99.     SpawnPoints.NumPoints = 1
  100.     SpawnPoints[0] = Vector3(500, 0, 500)
  101.     
  102.     -- Start Spawning the guys
  103.     BasicWave = createSpawnStruct()
  104.     
  105.     BasicWave.Prob.Basic    = 3.0;
  106.     BasicWave.Prob.Miner    = 1.0;
  107.     BasicWave.Prob.Spiker    = 1.0;
  108.     BasicWave.Prob.Stacker    = 1.0;
  109.     
  110.     BasicWave.SpawnSpeed    = 2.0;
  111.     BasicWave.MaxSpawn        = 15;
  112.     BasicWave.TotalSpawn    = 25;
  113.     BasicWave.GroupPercent    = 0.25;
  114.     BasicWave.GroupSize        = 3;
  115.     BasicWave.WhereToSpawn    = CircleAroundTower--HardCodedSpawnPoints
  116.     
  117.  
  118.     DrillerWave = createSpawnStruct()
  119.     
  120.     DrillerWave.Prob.Driller    = 1.0;
  121.     DrillerWave.SpawnSpeed        = 3;
  122.     DrillerWave.MaxSpawn        = 15;
  123.     DrillerWave.TotalSpawn        = 22;
  124.     DrillerWave.GroupPercent    = 1.0;
  125.     DrillerWave.GroupSize        = 3;
  126.     DrillerWave.WhereToSpawn    = SmallCircleAroundTower--HardCodedSpawnPoints
  127.         
  128.     AddWave( "BasicAttack", BasicWave )
  129.     G.SetMaxKills(25)
  130.     --StopWave( "BasicAttack" )
  131.     
  132.     GameWait(5)
  133.     WaitForClearEnemies()
  134.     GameWait(2)
  135.  
  136.     TraitorTalk("No sweat!  With our laser defended walls, we're unstoppable.")
  137.     GameWait(9)
  138.     TraitorTalk("I think we can just kick back and relax...");
  139.     GameWait(6);
  140.     TraitorTalk("Hey, what's that?");
  141.     GameWait(3)
  142.     
  143.     StartCinematic()
  144.         DrillerCinematic()
  145.     EndCinematic()
  146.     
  147.     
  148.     AddWave("DrillerWave", DrillerWave);
  149.     G.SetMaxKills(50)
  150.     
  151.     InvaderTextPopup( "Driller" );
  152.     GameWait(3)
  153.     
  154.     TraitorTalk("Ack, drillers!  They have the ability to tunnel underneath walls and other obstacles.  Don't let 'em near the tower!")
  155.     WaitForClearEnemies( )
  156.     
  157.     TraitorTalk("Whoa, I didn't count on them showing up.  I guess this isn't a perfect defense either...")
  158.     GameWait(7)
  159.     TraitorTalk("Beef up your defenses and do it fast, more are on their way!")
  160.     --G.AddCredits(50)
  161.     GameWaitOrMoney(30)
  162.     
  163.     BasicWave.SpawnSpeed = 4.0;
  164.     BasicWave.TotalSpawn = 50
  165.     BasicWave.MaxSpawn = 20
  166.     BasicWave.Prob.Driller = 1.5
  167.     BasicWave.Prob.Bomber = .5
  168.     G.SetMaxKills(100)
  169.     
  170.     TraitorTalk("Here they come.  Defend the base!");
  171.     GameWait(4);
  172.     
  173.     InvadersKilledWait(100)
  174.     
  175.     TraitorTalk("Keep it up! I only see one wave left!");
  176.     G.SetMaxKills(150)
  177.     GameWait(4)
  178.     TraitorTalk("Fix up the base, fast!")
  179.     GameWaitOrMoney(20)
  180.     
  181.     BasicWave.TotalSpawn = 50
  182.     
  183.     InvadersKilledWait(140)
  184.     
  185.     TraitorTalk("Keep up the defense, there is not much left!");
  186.     InvadersKilledWait(150) -- WaitForClearEnemies( )
  187.  
  188.     G.SetGameState( Victory );
  189.     
  190.     TraitorTalk("Nicely done.  We make an excellent team!")
  191.     GameWait(4)    
  192.     
  193. end
  194.  
  195.     
  196. levelRoutine = coroutine.create(LevelIntro);
  197.  
  198. GMain["LevelUpdate"] = LevelUpdate;
  199.